import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_study/widgets/public/themes/index.dart';
import 'package:rc_widget/rc_widget.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class AppEmpty extends StatelessWidget {
  const AppEmpty({super.key, this.height});
  final double? height;

  @override
  Widget build(BuildContext context) {
    return LayoutBuilder(builder: (_, size) {
      return IgnorePointer(
        child: Column(children: [
          SizedBox(
            width: double.infinity,
            height: height ?? size.maxHeight * 0.25,
          ),
          Icon(
            Icons.playlist_add_check_circle_outlined,
            size: 88.sp,
            color: AppThemes.of().colors.spinkit,
          ),
          SizedBox(
            height: 8.h,
          ),
          Text(
            '暂无数据'.tr,
            style: AppThemes.of().w400Text128,
          )
        ]),
      );
    });
  }
}

class AppFixedEmpty extends StatelessWidget {
  const AppFixedEmpty({super.key, this.height});
  final double? height;

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      height: height ?? 400.h,
      child: IgnorePointer(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Icon(
              Icons.playlist_add_check_circle_outlined,
              size: 64.sp,
              color: AppThemes.of().colors.spinkit,
            ),
            SizedBox(
              height: 8.h,
            ),
            Text(
              '暂无数据'.tr,
              style: AppThemes.of().w400Text128,
            )
          ],
        ),
      ),
    );
  }
}

class AppListEmpty extends StatelessWidget {
  const AppListEmpty({super.key, this.height});
  final double? height;

  @override
  Widget build(BuildContext context) {
    return LayoutBuilder(builder: (_, size) {
      return ListView(
        children: [
          IgnorePointer(
            child: Column(
              children: [
                SizedBox(
                  width: double.infinity,
                  height: height ?? size.maxHeight * 0.25,
                ),
                Icon(
                  Icons.playlist_add_check_circle_outlined,
                  size: 88.sp,
                  color: AppThemes.of().colors.spinkit,
                ),
                SizedBox(
                  height: 8.h,
                ),
                Text(
                  '暂无数据'.tr,
                  style: AppThemes.of().w400Text128,
                )
              ],
            ),
          )
        ],
      );
    });
  }
}

class AppSliverFixedEmpty extends StatelessWidget {
  final double? height;

  const AppSliverFixedEmpty({super.key, this.height});

  @override
  Widget build(BuildContext context) {
    return SliverToBoxAdapter(
      child: SizedBox(
        height: height ?? 400.h,
        child: IgnorePointer(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Icon(
                Icons.playlist_add_check_circle_outlined,
                size: 88.sp,
                color: AppThemes.of().colors.spinkit,
              ),
              SizedBox(
                height: 8.h,
              ),
              Text(
                '暂无数据'.tr,
                style: AppThemes.of().w400Text128,
              )
            ],
          ),
        ),
      ),
    );
  }
}
